package 多线程;

import static java.lang.Thread.sleep;

class MyThread extends Thread {
    @Override
    public void run(){
        while(true){
            System.out.println("hello thread");
            try {
                sleep(3000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class Demo1 {
    public static void main(String[] args) throws InterruptedException {
        Thread T = new MyThread();
        T.start();
        while(true){
            System.out.println("hello main");
            sleep(3000);
        }
    }

}
